﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
using VSTO = Microsoft.Office.Tools.Excel;
using Microsoft.Office.Tools.Excel.Extensions;


using System.Windows.Forms;


namespace ExcelAddInTest
{
    public partial class ThisAddIn
    {
        VSTO.SmartTag tag;
        VSTO.Action myAction;
        VSTO.Action myAction2;


        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {

         
            tag = new VSTO.SmartTag("http://www.upriseapps.com/#officeincloud", "Office In Cloud");
            tag.Terms.Add("Office");
            tag.Terms.Add("Cloud");
            tag.Terms.Add("Microsoft");
            tag.Terms.Add("Andrew");
            tag.Terms.Add("Gorlushko"); 


            myAction =
            new VSTO.Action("&Fishing///&Catch a fish...");
            myAction2 =
              new VSTO.Action("&Fishing///&Throw it back...");
            tag.Actions =
              new VSTO.Action[] { myAction, myAction2 };

            myAction.Click += new
              VSTO.ActionClickEventHandler(myAction_Click);
            myAction2.Click += new
              VSTO.ActionClickEventHandler(myAction2_Click);

            

            this.VstoSmartTags.Add(tag);
            
            this.Application.SmartTagRecognizers.Recognize = true;
            
        }

        void myAction2_Click(object sender, VSTO.ActionEventArgs e)
        {
            MessageBox.Show(String.Format(
              "You threw back a fish at position {0}.",
              e.Range));
        }

        void myAction_Click(object sender, VSTO.ActionEventArgs e)
        {
            MessageBox.Show(String.Format(
              "Open in LinkedIn",
              e.Range));
        }


        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
        }

        #region VSTO generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
        
        #endregion
    }
}
